#include "threadPool.h"
#define clientclose 1
// int recvn(int sockfd,void *buf, int length){
//     int total = 0;
//     char *p = (char *)buf;
//     while(total < length){
//         ssize_t sret = recv(sockfd,p+total,length-total,0);
//         //if(sret==-1)
//         printf("sret = %ld,client close\n",sret);
//         total += sret;
//         printf("total+=sret\n");
//     }
//     return 0;
// }

int recvn(int sockfd,void *buf, int length){
    int total = 0;
    char *p = (char *)buf;
    while(total < length){
        ssize_t sret = recv(sockfd,p+total,length-total,0);
        if(sret==0)
        {
            printf("sret = %ld,client close\n",sret);
            return clientclose;
            break;
        }
        //printf("sret = %ld,client close\n",sret);
        total += sret;
    }
    return 0;
}